<template>
  <div>
    <Search
      v-model="querylist.query"
      @search="querylist.pagenum = 1; getgoods(); "
     
      >添加用户</Search
    >
    <MyTable
      v-model="querylist"
      :loading="queryloading"
      :cols="cols"
      :total="total"
      :data="list"
      @change="getgoods()"
    ></MyTable>
  </div>
</template>

<script>
import { pageMixins } from "../../mixin/baseMixin";
import { getGoodsList } from "../../api/goods.js";
export default {
  name: "goods",
  mixins: [pageMixins],
  data() {
    return {
      cols: [
        { title: "#", type: "index" },
        { title: "商品名称", name: "goods_name" },
        { title: "商品价格（元）", name: "goods_price", width: 150 },
        { title: "商品重量", name: "goods_weight", width: 150 },
        { title: "创建时间", name: "time", width: 150 },
        { title: "操作", align: "center", width: 150, slot: "action" },
      ],
    };
  },

  mounted() {},
  methods: {
    async getgoods() {
      try {
        this.queryloading = true;
        const { total, goods } = await getGoodsList(this.querylist);
        this.list = goods;
        this.total = total;
      } catch (error) {}
      this.queryloading = false;
    },
  },
  created() {
    this.getgoods();
  },
};
</script>

<style scoped lang="scss">
.el-input {
  width: 300px;
}
</style>
